<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			html, body{
				height: 100%;
				overflow: hidden;
			}
			#canvas{
				background: pink;
			}
		</style>
		<script>
			window.onload = function(){
				var canvas = document.getElementById("canvas");
				canvas.width = document.body.clientWidth
				if(canvas.getContext){
					var index = 0
					var imgs = ["../../img/tank/tk1.gif", "../../img/tank/tk2.gif", "../../img/tank/tk3.gif", "../../img/tank/tk4.gif", ]					
					var ctx = canvas.getContext("2d")
					
					setInterval(function(){
						ctx.clearRect(0,0,100,400)
						index = index % 4
						ctx.translate(5, 0)
						var img  = new Image()
						img.src = imgs[index]
						img.onload = draw
						index++
					}, 100)
					
					function draw(){
						ctx.drawImage(img, 0, (canvas.height - img.height) / 2, img.width, img.height)
					}
				}
			}
		</script>
	</head>
	<body id="body">
		<canvas id="canvas" width="400px" height="400px">
			<span><a href="39.108.121.57:8080">您的浏览器不支持画布元素, 请您换成萌萌的chrome浏览器</a></span>
		</canvas>
	</body>
</html>
